const mongoose = require("mongoose");
const mongoUrl = "mongodb://users:123456@8.140.6.49/el";
module.exports = (app) => {
	// 将useNewUrlParser设置为true来避免“不建议使用当前URL字符串解析器”警告
	// DeprecationWarning: current Server Discovery and Monitoring engine is
	// deprecated, and will be removed in a future version
	mongoose.connect(
		mongoUrl,
		{
			useNewUrlParser: true,
			useFindAndModify: false,
			useUnifiedTopology: true,
		},
		() => {
			console.log("mongodb connect");
		}
	)
};
const connection = mongoose.connection
connection.once("open", function () {
	console.log("MongoDB database connection established successfully");
});
